<template>
  <!-- 机票订单页面 -->
  <div class="container">
    <!-- 1.机票订单表单 -->
    <el-row type="flex" justify="space-between">
      <div class="main">
        <!-- 1.机票订单-表单组件 -->
        <orderForm v-if="infoData" :data="infoData" @setAllPrice="setAllPrice" />
      </div>

      <!-- 2.侧边栏 -->
      <div class="aside">
        <!-- 机票订单-侧边栏组件 -->
        <orderSide v-if="infoData" :data="infoData" :totalPrice="totalPrice" />
      </div>
    </el-row>
  </div>
</template>

<script>
//1.机票订单-表单组件
import orderForm from "@/components/air/orderForm";
//2.机票订单-侧边栏组件
import orderSide from "@/components/air/orderSide";
export default {
  components: {
    orderForm,
    orderSide
  },
  //数据
  data() {
    return {
      //机票座位数据
      infoData: null,
      totalPrice: 0
    };
  },
  created() {
    //选择机票接口数据（参数航班id,和座位id）
    this.$axios({
      url: "airs/" + this.$route.query.id,
      params: { seat_xid: this.$route.query.seat_xid }
    }).then(res => {
      console.log(res);
      this.infoData = res.data;
    });
  },
  methods: {
    //子传父数据
    setAllPrice(val) {
      console.log(val);
      this.totalPrice = val;
    }
  }
};
</script>

<style lang="less" scoped>
.container {
  width: 1000px;
  margin: 20px auto;
  //订单
  .main {
  }
  //侧边栏
  .aside {
    width: 350px;
    height: fit-content;
    border: 1px solid #ddd;
  }
}
</style>